-
Notifications
You must be signed in to change notification settings - Fork 3
[AE-158] Add Github Actions [draft] #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3444673
to
2f3eddd
Compare
type: arduino:mbed_portenta | ||
- fqbn: arduino:renesas_portenta:portenta_c33 | ||
type: renesas_portenta | ||
- fqbn: arduino:mbed:opta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type: arduino:mbed_portenta | |
- fqbn: arduino:renesas_portenta:portenta_c33 | |
type: renesas_portenta | |
- fqbn: arduino:mbed:opta | |
platforms: | | |
- name: arduino:mbed_portenta | |
- fqbn: arduino:renesas_portenta:portenta_c33 | |
platforms: | | |
- name: arduino:renesas_portenta | |
- fqbn: arduino:mbed_opta:opta | |
platforms: | | |
- name: arduino:mbed_opta |
- Correct platform dependency definitions
- Use the family-specific
arduino:mbed_opta
platform instead of the deprecatedarduino:mbed
in order to get the latest version of the platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The definition schema I used here - with the type:
key - is similar to what is currently in use inside other Arduino libraries such as the Arduino_ESP32_OTA.
Do we have a reference regarding the platform definitions? I could not find type:
mentioned here as deprecated or otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar to what is currently in use inside other Arduino libraries such as the Arduino_ESP32_OTA.
There wasn't any benefit from the use of this approach in the Arduino_ESP32_OTA library so that workflow isn't a good reference. A better example of the use of this approach is in these workflows:
- https://github.com/arduino/arduino-examples/blob/main/.github/workflows/compile-examples.yml
- https://github.com/arduino-libraries/ArduinoIoTCloud/blob/master/.github/workflows/compile-examples.yml
The jobs.<job_id>.strategy.matrix
workflow key is used to create multiple variants of the workflow job. In the case of the sketch compilation workflows, we use a separate job for each of the boards we want to compile the sketches for.
The job is configured differently for each board. In the most simple case, only the FQBN is different from one matrix job to another, but often we have other adjustments (such as the platform dependency). You can make those adjustments directly in the matrix element:
matrix:
board:
- fqbn: arduino:avr:uno
platforms: |
- name: arduino:avr
libraries: |
- name: SomeAVRLib
But in cases where the same configuration is needed for a multiple boards, this results in code duplication in the workflow.
For example, notice that the same platform and library dependency configurations must be duplicated multiple times in this matrix:
matrix:
board:
- fqbn: arduino:avr:leonardo
platforms: |
- name: arduino:avr
libraries: |
- name: SomeAVRLib
- fqbn: arduino:avr:mega
platforms: |
- name: arduino:avr
libraries: |
- name: SomeAVRLib
- fqbn: arduino:avr:uno
platforms: |
- name: arduino:avr
libraries: |
- name: SomeAVRLib
- fqbn: arduino:samd:mkrzero
platforms: |
- name: arduino:samd
libraries: |
- name: SomeSAMDLib
- fqbn: arduino:samd:arduino_zero_edbg
platforms: |
- name: arduino:samd
libraries: |
- name: SomeSAMDLib
If we want to follow the software development best practice of "DRY", we can instead add an object for the relevant attribute of the boards to the matrix elements then use the jobs.<job_id>.strategy.matrix.include
workflow key to apply the shared configuration to each of the jobs that have that object set to a given value:
matrix:
board:
- fqbn: arduino:avr:leonardo
type: avr
- fqbn: arduino:avr:mega
type: avr
- fqbn: arduino:avr:uno
type: avr
- fqbn: arduino:samd:mkrzero
type: samd
- fqbn: arduino:samd:arduino_zero_edbg
type: samd
include:
- board:
type: avr
platforms: |
- name: arduino:avr
libraries: |
- name: SomeAVRLib
- board:
type: samd
platforms: |
- name: arduino:samd
libraries: |
- name: SomeSAMDLib
Do we have a reference regarding the platform definitions?
https://github.com/arduino/compile-sketches#platforms
I could not find
type:
mentioned here
That is because it is general purpose GitHub Actions workflow code; nothing specific to the arduino/compile-sketches
action. The type
key name is only an arbitrary identifier. You could use foobar
instead and it will work just the same.
If you want to understand better, I recommend you create a throwaway repository and experiment with some simple "hello world" type workflows. For example:
on:
push:
jobs:
hello:
runs-on: ubuntu-latest
strategy:
matrix:
some-matrix-object-key:
- some-matrix-element-object-key: This is the value of some matrix element object for the 1st element
some-matrix-element-object-include-key: foo
- some-matrix-element-object-key: This is the value of some matrix element object for the 2nd element
some-matrix-element-object-include-key: foo
- some-matrix-element-object-key: This is the value of some matrix element object for the 3rd element
some-matrix-element-object-include-key: bar
- some-matrix-element-object-key: This is the value of some matrix element object for the 4th element
some-matrix-element-object-include-key: bar
include:
- some-matrix-object-key:
some-matrix-element-object-include-key: foo
some-include-element-object-key: This is the value of some include element object for the matrix elements with value foo
- some-matrix-object-key:
some-matrix-element-object-include-key: bar
some-include-element-object-key: This is the value of some include element object for the matrix elements with value bar
steps:
- run: |
echo "The value of some matrix element object is: ${{ matrix.some-matrix-object-key.some-matrix-element-object-key }}"
echo "The value of some include element object is: ${{ matrix.some-include-element-object-key }}"
The workflow above will work exactly the same if you changed the arbitrary key name some-matrix-element-object-include-key
to type
or foobar
or amazing-key-name
.
2f3eddd
to
9934b7c
Compare
Co-authored-by: per1234 <[email protected]>
Co-authored-by: per1234 <[email protected]>
Unable to compile library examples due to Arduino_POSIXStorage library is a dependency of this repo. But the GitHub action cannot find it.
|
This PR adds workflows for automated compilance checks.